package com.zbf.线程池;

import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.RejectedExecutionHandler;
import java.util.concurrent.ThreadPoolExecutor;

/**
 * @author: LI-CI-GAO
 * 作者: licigao
 * 日期: 2021/8/14  11:07
 * 描述:
 */
public class MyRejectedHandler implements RejectedExecutionHandler {

    private LinkedBlockingDeque<Runnable> linkedBlockingDeque;

    public MyRejectedHandler(LinkedBlockingDeque<Runnable> linkedBlockingDeque) {
        this.linkedBlockingDeque = linkedBlockingDeque;
    }

    @Override
    public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) {

        System.out.println("=====拒绝执行加入队列=====");
        linkedBlockingDeque.add(r);



    }
}
